/*
 * Copyright (c) 2012, 2021, daojian.co and/or its affiliates. All rights reserved.
 *
 */

package co.bugu.code.analysis.application.service;

import co.bugu.code.analysis.infra.entity.User;
import co.bugu.code.analysis.infra.repo.UserRepo;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 业务编排类
 *
 * @author happy-coder
 * @version 1.0.0
 * @createdAt 2022-06-11 11:21:37
 * @updatedAt 2022-06-11 11:21:37
 */
@Service
public class UserService {
    @Autowired
    UserRepo userRepo;


    public User findByUserId(Long userId){
        User query = new User();
        query.setUserId(userId);
        List<User> users = userRepo.findByCondition(query);
        if(CollectionUtils.isNotEmpty(users)){
            return users.get(0);
        }
        return null;
    }

}
